package com.enation.app.javashop.core.client.fallback.member;

import com.enation.app.javashop.core.client.feignimpl.member.ConnectClientFeignImpl;
import com.enation.app.javashop.core.handler.BaseFallbackFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.enation.app.javashop.model.member.dos.ConnectDO;
import com.enation.app.javashop.model.payment.enums.WechatTypeEnmu;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 *会员地址熔断 fallback factory
 * @author kingapex
 * @version 1.0
 * @data 2022/5/28 14:24
 **/
@Component
public class ConnectClientFallbackFactory extends BaseFallbackFactory<ConnectClientFeignImpl>{
    @Override
    protected ConnectClientFeignImpl fallback() {
        return new ConnectClientFallback();
    }

    /**
     * 会员地址熔断
     *
     * @author zh
     * @version v7.0
     * @date 19/9/27 下午3:27
     * @since v7.0
     */
    @Component
    public static class ConnectClientFallback implements ConnectClientFeignImpl {

        private final Logger logger = LoggerFactory.getLogger(getClass());


        @Override
        public ConnectDO getConnect(Long memberId, String unionType) {

            logger.error("获取第三方登录信息出错，会员id" + memberId + ",type:" + unionType);

            return null;
        }

        @Override
        public String getMemberOpenid(Long memberId) {

            logger.error("获取会员的openid出错，会员id" + memberId);
            return null;
        }

        @Override
        public String getCgiAccessToken(WechatTypeEnmu wechatTypeEnmu) {
            logger.error("生成 CGI 接口 access token ，服务器与微信的接口token出错");
            return null;
        }

        @Override
        public Map getConnectConfig(WechatTypeEnmu wechatTypeEnmu) {

            logger.error("getConnectConfig出错:" + wechatTypeEnmu);
            return null;
        }
    }
}
